package com.taboo.climber.assistant.controller;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: changle1
 * @Description:
 * @Date: Created on 9:58 2025/6/17
 */
@RestController
public class AiTestController {
	private final ChatClient chatClient;

	public AiTestController(ChatClient.Builder chatClientBuilder) {
		this.chatClient = chatClientBuilder.build();
	}

	@GetMapping("/ai")
	public String generation(@RequestParam("question") String question) {
		return this.chatClient
				.prompt(question)
				.call()
				.content();
	}
}
